Open
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Member
|
Thanks for this pr! I don't believe we should grant such extensive permissions to LLMs, at least not by default. If necessary, we can enable these features via a flag (disabled by default). Additionally, we need some tests to ensure the behavior is generally correct. |
jbkjr
pushed a commit
to jbkjr/mcp-email-server
that referenced
this pull request
Jan 15, 2026
Address maintainer feedback on PR ai-zerolab#99: - Add enable_folder_management config flag (disabled by default) - All folder management tools now require explicit opt-in - Add MCP_EMAIL_SERVER_ENABLE_FOLDER_MANAGEMENT env var support - Add comprehensive tests for folder management (30 new tests) - Update README documentation with new setting Tests cover: - Permission checks when disabled (6 tests) - Tool functionality when enabled (6 tests) - Handler method tests (6 tests) - EmailClient IMAP operation tests (6 tests) - Edge cases (3 tests) - Config tests (3 tests) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Author
|
Thanks for the feedback! I've addressed your concerns: Changes Made1. Feature Flag (Disabled by Default)
2. Test CoverageAdded 30 new tests covering:
All 140 tests pass (110 existing + 30 new). |
Member
|
Can you resolve the conflict? |
d36ffe7 to
4270249
Compare
Contributor
Author
|
Merge conflicts resolved - rebased onto main. Ready for review. |
Add 6 new MCP tools for IMAP folder operations: - list_folders: List all folders/mailboxes with flags - move_emails: Move emails between folders (MOVE or COPY+DELETE fallback) - copy_emails: Copy emails to folder (useful for labels in Proton Mail) - create_folder: Create new folders - delete_folder: Delete folders - rename_folder: Rename folders This enables full folder management through the MCP interface, with special consideration for Proton Mail Bridge compatibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Address maintainer feedback on PR ai-zerolab#99: - Add enable_folder_management config flag (disabled by default) - All folder management tools now require explicit opt-in - Add MCP_EMAIL_SERVER_ENABLE_FOLDER_MANAGEMENT env var support - Add comprehensive tests for folder management (30 new tests) - Update README documentation with new setting Tests cover: - Permission checks when disabled (6 tests) - Tool functionality when enabled (6 tests) - Handler method tests (6 tests) - EmailClient IMAP operation tests (6 tests) - Edge cases (3 tests) - Config tests (3 tests) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add 6 new MCP tools for managing ProtonMail labels: - list_labels: List all labels (filters Labels/ prefix folders) - apply_label: Apply label to emails (copy to Labels/X) - remove_label: Remove label from emails (delete from Labels/X) - get_email_labels: Get all labels for an email - create_label: Create new label - delete_label: Delete label Labels in ProtonMail Bridge are exposed as IMAP folders under the Labels/ prefix. These tools provide semantic operations for label management while using the underlying folder operations. Includes comprehensive tests (26 new tests, all passing). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add clearer documentation for the mailbox parameter across all tools, explaining standard IMAP folders and provider-specific paths for Gmail ([Gmail]/...) and ProtonMail Bridge (Folders/<name>, Labels/<name>). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add functionality to mark emails as read or unread using IMAP \Seen flag: - EmailMarkResponse model for operation results - mark_emails abstract method in EmailHandler - Implementation in EmailClient and ClassicEmailHandler - MCP tool exposed via app.py Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Clarify that move_emails removes from source folder and apply_label only tags without removing from INBOX. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Cherry-picked test improvements from feature/folder-management: - Comprehensive tests for folder management edge cases - Tests for _parse_list_response exception handling - Tests for EmailClient.delete_emails coverage - Ruff RUF059 fixes for unused variables Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Cherry-picked test improvements from pr/mark-read-unread: - Comprehensive tests for mark_emails functionality - Logout error test for mark_emails coverage Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
4270249 to
d3c7b97
Compare
for more information, see https://pre-commit.ci
Remove TestParseHeaderToMetadata (uses non-existent _parse_header_to_metadata) and TestGetEmailsStreamWithSort (tests SORT capability from PR ai-zerolab#107) that were accidentally included during rebase. These test upstream's batch fetch implementation, not the folder management feature. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds 6 new MCP tools for IMAP folder management:
list_folders- List all folders/mailboxes with IMAP flags and delimitersmove_emails- Move emails between folders (uses MOVE command with COPY+DELETE fallback)copy_emails- Copy emails to a folder while preserving the original (standard IMAP COPY)create_folder- Create new foldersdelete_folder- Delete foldersrename_folder- Rename foldersSecurity
All folder management tools are disabled by default. Users must explicitly opt-in by setting:
MCP_EMAIL_SERVER_ENABLE_FOLDER_MANAGEMENT=trueenable_folder_management = trueThis addresses the concern about granting extensive permissions to LLMs by default.
Implementation Details
_quote_mailbox()function for RFC 3501 compatibilitymove_emailsattempts RFC 6851 MOVE command first, falls back to COPY + STORE \Deleted + EXPUNGEFolder,FolderListResponse,FolderOperationResponse,EmailMoveResponseEmailHandlerbase class for extensibilitysource_mailboxdefaults to "INBOX" for consistency with existing toolsTest plan
🤖 Generated with Claude Code